// 获取token信息
function token() {
	// 初始化返回值
	var data_return = false;
	// 读取临时缓存
	// var save_short = uni.$focus.varForever();
	var save_short = uni.$focus.varForever('get');
	if (save_short && save_short.token) { data_return = save_short.token; }
	// 返回数据
	return data_return;
}

export default {
	//首页证书
	getCertificateType:function(objC){
		uni.$focus.request({
			method: "get",
			data:{
				...objC.data,
				user_id:uni.getStorageSync("eduInfo").userId,
			},
			openToast: false, 
			url: `/aq_course/app/v2/cert/certTypeCount`,
			header: {
				"token": token()||""
			},
			success: (res) => {
				// 回调数据
				if (objC.success) { objC.success(res); }
			},
			fail:(err)=>{
				if (objC.fail) { objC.fail(err); }
			}
		});
	},
	//入场学习学习权限
	enterStudyRecord:function(objC){
		uni.$focus.request({
			method: "get",
			data:objC.data,
			openToast: false, 
			openGreen: true, 
			url: `/aq_course/app/v2/cert/scoreLogWxEntranceStudy`,
			header: {
				"token": token()||""
			},
			success: (res) => {
				// 回调数据
				if (objC.success) { objC.success(res); }
			},
			fail:(err)=>{
				if (objC.fail) { objC.fail(err); }
			}
		});
	},
	//首次入场权限
	getLastStudy:function(objC){
		uni.$focus.request({
			method: "get",
			data:objC.data,
			openToast: false, 
			openGreen: true, 
			url: `/aq_course/app/v2/cert/readingPosition`,
			header: {
				"token": token()||""
			},
			success: (res) => {
				// 回调数据
				if (objC.success) { objC.success(res); }
			},
			fail:(err)=>{
				if (objC.fail) { objC.fail(err); }
			}
		});
	},
	//入场学习学分
	getEnterScore:function(objC){
		uni.$focus.request({
			method: "get",
			data:objC.data,
			openToast: false, 
			openGreen: true,   
			url: `/aq_course/app/v2/cert/admissionStudy`,
			header: {
				"token": token()||""
			},
			success: (res) => {
				// 回调数据
				if (objC.success) { objC.success(res); }
			},
			fail:(err)=>{
				if (objC.fail) { objC.fail(err); }
			}
		});
	},
	//证书
	getCertificatePage:function(objC){
		uni.$focus.request({
			method: "get",
			data:{
				...objC.data,
				user_id:uni.getStorageSync("eduInfo").userId,
				id_card:uni.getStorageSync("eduInfo").id_card2
			},
			openToast: false, 
			url: `/aq_course/app/v2/cert/certListIndex`,
			header: {
				"token": token()||""
			},
			success: (res) => {
				// 回调数据
				if (objC.success) { objC.success(res); }
			},
			fail:(err)=>{
				if (objC.fail) { objC.fail(err); }
			}
		});
	},
	//入场学习
	scoreForStudy: function(objC) {
		uni.$focus.request({
			method: "get",
			url: '/aq_course/app/v2/cert/admissionStudy',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token() || ''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	
	//测评记录
	getTestRecordList: function(objC) {
		uni.$focus.request({
			method: "get",
			url: '/aq_user/v2/paper/getSentryPidPaperList',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	
	
	
	//新考人员问答详情
	getQuestionAndAnswerDetail: function(objC) {
		uni.$focus.request({
			method: "get",
			url: '/aq_attach/v2/problem/problemList',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	
	//新考人员问答
	getQuestionAndAnswer: function(objC) {
		uni.$focus.request({
			method: "get",
			url: '/aq_attach/v2/problem/problemCategoryList',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	
	//新考人员测评规则
	getNewTestRoles: function(objC) {
		uni.$focus.request({
			method: "get",
			url: '/aq_user/v2/paper/getSentryPidPaperCount',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	
	
	
	
	
	//获取考试时间
	getTimeLast: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "get",
			url: '/aq_user/v2/paper/getWorkPaperTime',
			data: objC.data,
			openToast: true, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	//信息确认页
	infoConfirm: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "post",
			url: '/aq_user/v2/paperRanking/postWorkInfoChange',
			data: objC.data,
			openToast: true, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
		//交卷
	handPaper: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "post",
			url: '/aq_user/v2/paper/workSubmitPaper',
			loadingText: "交卷中",
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});		
	},
	//答题
	answerQuestion: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "post",
			url: '/aq_user/v2/paper/workAnswer',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});	
			
			
	},

	//获取试卷
	getQuestionList: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "get",
			url: '/aq_user/v2/paper/getPaperQuestionList',
			data: objC.data,
			openToast: false,  
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
					
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});	
			
			
	},
	//组卷
	createWorkPaper: function(objC) {
		// 接口请求
		uni.$focus.request({
			method: "post",
			url: '/aq_user/v2/paper/createWorkPaper',
			data: objC.data,
			openToast: false, 
			header: {
				"token": token()||''
			},
			fail: (err) => {
				if(objC.fail){
					objC.fail(err)
				}
					
			},
			success: (res) => {
				if(objC.success){
					objC.success(res);
				}					
			}
		});	
	},
	//获取首页banner
	// getBannerList: function(objC) {
	// 	uni.$focus.request({
	// 		method: "get",
	// 		url: '/aq_attach/v2/adpopup/getBannerList',
	// 		data: objC.data,
	// 		header: {
	// 			"token": token()||''
	// 		},
	// 		openToast: false, 
	// 		fail: (err) => {
	// 			if(objC.fail){
	// 				objC.fail(err)
	// 			}
	// 		},
	// 		success: (res) => {
	// 			if(objC.success){
	// 				objC.success(res);
	// 			}          
	// 		}
	// 	});    
	// },
	//获取客服电话
	// getCustomerService: function(objC) {
	// 	uni.$focus.request({
	// 		method: "get",
	// 		url: '/aq_user/v2/common/createUlQqToken',
	// 		data: objC.data,
	// 		header: {
	// 			"token": token()||''
	// 		},
	// 		fail: (err) => {
	// 			if(objC.fail){
	// 				objC.fail(err)
	// 			}
	// 		},
	// 		success: (res) => {
	// 			if(objC.success){
	// 				objC.success(res);
	// 			}          
	// 		}
	// 	});    
	// },
	
	
	
	
}